﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Admin.Shop.OrderMan
{
    public partial class OrderList : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            IsLogin();
            GetShopOrderListByOrderState();
        }


        protected void GetShopOrderListByOrderState()
        {
            int shopID = Convert.ToInt32(Session["ShopID"]);
            int orderState = Convert.ToInt32(OrderState.SelectedValue);
            DataSet ds = new NS.BLL.Orders().GetShopOrderListByOrderState(orderState,shopID);
            Orders.DataSource = ds;
            Orders.DataBind();
        }

        protected void Orders_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            Orders.PageIndex = e.NewPageIndex;
            GetShopOrderListByOrderState();
        }

        protected void OrderState_SelectedIndexChanged(object sender, EventArgs e)
        {
            GetShopOrderListByOrderState();
        }

        protected void UpdateOrderState_SelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList dp = sender as DropDownList;
            string orderID = dp.Attributes["orderid"].ToString();
            int orderState = Convert.ToInt32(OrderState.SelectedValue);
            new NS.BLL.Orders().UpdateOrderState(orderID, orderState);

            Maticsoft.Common.MessageBox.Show(this,"订单状态修改成功");
        }

    }
}